# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=pluggy
pkgbase=python-pluggy
pkgname=(python-${_realname})
pkgver=0.13.1
pkgrel=2
pkgdesc="Plugin and hook calling mechanisms for python"
arch=('any')
url="https://www.pluggypayments.com/docs/python"
license=('MIT')
depends=('python')
makedepends=('python-setuptools' 'python-setuptools-scm')
checkdepends=('python-pytest-runner')
provides=("python3-${_realname}")
replaces=("python3-${_realname}")
conflicts=("python3-${_realname}")
source=("${pkgbase}-${pkgver}.tar.gz::https://github.com/pytest-dev/pluggy/archive/${pkgver}.tar.gz")
sha512sums=('3269f7ad7801a70ba8aa3182c568f70e2ee88a90b6f6335be631f9737dd42fac3fb1b27c5b6fe6422de128ddcc58736f0c41ed60b7c0177126dd676b98ece301')

prepare() {
  # Set version for setuptools_scm
  export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  /usr/bin/python setup.py build
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  /usr/bin/python setup.py pytest
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  /usr/bin/python setup.py install -O1 --root "${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
